#ifndef O_LARGEFILE
#define O_LARGEFILE 0100000
#endif
#define _GNU_SOURCE
#define _LARGEFILE_SOURCE  
#define _LARGEFILE64_SOURCE  
#define _FILE_OFFSET_BITS 64
#include <jni.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <ctype.h>
#include <stdint.h>
#include <limits.h>
#include <sys/file.h>
#include "tr_edu_ozyegin_ccrg_raid_rawdisk_DiskStat.h"

JNIEXPORT jlong JNICALL Java_tr_edu_ozyegin_ccrg_raid_rawdisk_DiskStat_statFile
  (JNIEnv *env, jobject jobj, jstring name){
    int fd;
  //unsigned char *buffer;
  int i, j,readed=0;
	//buffer = (char *)malloc((int)((uint64_t)blockSize));
jboolean iscopy;
      const jchar *mfile = (*env)->GetStringUTFChars(env, name, &iscopy);
  fd = open64(mfile, O_RDONLY | O_LARGEFILE);
  if(fd < 0){ return 0;}
  readed = 0;
  //if(BlockID !=0){
  //	int i;
  	uint64_t seeked = 0;
  	
  	
  	seeked = lseek64(fd,0l,SEEK_END);
  	if(seeked < 0){ return 0;}
	(*env)->ReleaseStringChars(env, name, mfile);
    close(fd);
    return (jlong)seeked;
}
